package com.lsh.multithreading;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/12/18 4:48 下午
 * @desc ：演示未同步代码
 */
public class UnSynchronized {

    public static void main(String[] args) {
        new Thread(() ->{
            while(true){
                Printer.print1();
            }
        }).start();

        new Thread(() ->{
            while (true){
                Printer.print2();
            }
        }).start();
    }


}
class Printer {
    public static void print1() {
        System.out.print("1 ");
        System.out.print("2 ");
        System.out.print("3 ");
        System.out.print("4 ");
        System.out.print("\r\n");
//		System.out.println("1 2 3 4 ");
    }

    public static void print2() {
        System.out.print("一 ");
        System.out.print("二 ");
        System.out.print("三 ");
        System.out.print("四 ");
        System.out.print("\r\n");
//		System.out.println("一 二 三 四 ");
    }
}
